Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch ra-realtime for 3.x #5272

Closed
wants to merge 2 commits into from
Closed

Patch ra-realtime for 3.x #5272

wants to merge 2 commits into from

Conversation

gstvg
Copy link
Contributor

@gstvg gstvg commented Sep 18, 2020

Hi, this patch allow using ra-realtime on 3.x

The only 2 changes are:

import { LOCATION_CHANGE } from 'react-router-redux'; for import { LOCATION_CHANGE } from "connected-react-router";

And get fetchType from the action type, and not action payload meta.fetch, because even if it exists on

https://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/actions/dataActions/crudGetList.ts
https://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/actions/dataActions/crudGetOne.ts

it is not present on the actual payload, as you can see on the console output on the example below.

I made this as a draft on 2.x because it was easier and didn't know if you want this on 3.x branch or prefer that i create a new repo for it. If you want this on 3.x, i create a new, non-draft pull request on it, and converted to TypeScript.

Commenting #3908, i agree that the actual approach is not optimal, one reason is that for example, with graphql subscriptions or firebase realtime db/firestore, it firsts asks a normal, non-realtime request, and right after asks a realtime one, which return the first result very fast and likely the same as the normal request, ending up with one unnecessary request. So, what do you think about allowing dataProviders to return observable requests, likely with a next function on the response object that awaits for new data and then returns it?

Working example (posts list only):

https://codesandbox.io/s/jovial-swirles-gn3un

Working live:

https://gn3un.sse.codesandbox.io/#/posts

@fzaninotto
Copy link
Member

Hi, and thanks for your patch.

We've rewritten ra-realtime rom scratch to make it work on 3.x, and added more features (like lock detection). It's now part of the Enterprise Edition (see https://marmelab.com/ra-enterprise/modules/ra-realtime).

So we won't be merging your code. Feel free to publish it as a standalone package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants